﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using hedefgrup.graphicsLibrary;
using hedefgrup.reports.renault.date;
using System.Drawing;
using System.Globalization;

public partial class forms_common_graph2: reportPage
{
    private static CultureInfo english = CultureInfo.GetCultureInfo("en-US");

    protected void Page_Load(object sender, EventArgs e)
    {
        base.initialize();
        base.ensureUserIsLoggedIn();

        reportMonth month = base.getReportMonth();
        string mapName = string.Format("Dispersion QVN Renault - Türkiye - 12 Aylık / {0} - {1:00}", month.getYear(), month.getMonth());

        string[] xValuesAsString = base.getString("x").Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
        string[] yValuesAsString = base.getString("y").Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

        float[] xValues = new float[xValuesAsString.Length];
        float[] yValues = new float[yValuesAsString.Length];

        for (int i = 0; i < xValues.Length; i++)
        {
            xValues[i] = Convert.ToSingle(xValuesAsString[i], english);
            yValues[i] = Convert.ToSingle(yValuesAsString[i], english);
        }
        
        graphic gr = new dispersionGraphic();

        gr.mapNameLines = new string[] { mapName };

        gr.xMinimumValue = 0;
        gr.xMaximumValue = 100;
        gr.xInterval = 10;

        gr.yMinimumValue = 0;
        gr.yMaximumValue = 20;
        gr.yInterval = 2;

        gr.xValues = xValues;
        gr.yValues = yValues;

        gr.mapNameFont = new Font("tahoma", 19F, FontStyle.Regular);

        Response.ContentType = "image/gif";
        gr.WriteImage(Response.OutputStream);
    }
}
